<template>
  <div class="content">
    <div class="h-input-group">
      <Select v-model="select" :datas="param"></Select>
    </div>
    <div class="h-input-group">
      <input readonly type="text" v-model="text" placeholder="内容" /><Button @click="copyText" color="primary">复制</Button>
    </div>
  </div>
</template>
<script type="text/javascript">
export default {
  data() {
    return {
      select: '',
      param: ['选择1', '选择2', '选择3']
    };
  },
  /**
   * 计算属性
   * @type {Object}
   */
  computed: {
    text() {
      let url = this.$cloud.AppURL;
      let AppID = this.$cloud.AppID;
      return url + '/' + AppID + '/' + this.select;
    }
  },
  /**
   * 数据监听
   * @type {Object}
   */
  watch: {

  },
  /**
   * 页面加载执行
   * @return {[type]} [description]
   */
  async mounted() {
    this.handleApplyInfo();
  },
  /**
   * 页面方法
   * @type {Object}
   */
  methods: {
    affirm(e) {
      let { handleCancel } = e;
      handleCancel();
    },
    handleApplyInfo() {
      this.$cloud.project().get(this.$cloud.AppID).then(res => {
        this.param = Object.keys(res.config.apply);
        this.select = this.param[0] || '';
      }).catch(error => {
        console.log('错误', error);
      });
    },
    copyText() {
      this.$Clipboard({
        text: this.text
      });
    }
  }
};

</script>
<style type="text/css" scoped="true">
.h-input-group {
  margin-bottom: 20px;
}

</style>
